<include file="Public/head" />

<body>
  <div class="panel admin-panel">
    <div class="panel-head"><strong><span class="icon-pencil-square-o"></span> {:L("wangzhanpeizhi")}</strong></div>
    <div class="body-content">
      <form method="post" class="form-x" action="" enctype="multipart/form-data">
        <div class="form-group">
          <div class="label">
            <label>{:L("wangzhanbiaoti")}：</label>
          </div>
          <div class="field">
            <input type="text" class="input w50" name="web_title" value="{$info['web_title']}" data-validate="required:{:L('qingshuru')}{:L('wangzhanbiaoti')}"/>
            <div class="tips"></div>
          </div>
        </div>
        <div class="form-group">
          <div class="label">
            <label>{:L("wangzhanguanjianci")}：</label>
          </div>
          <div class="field">
            <input type="text" class="input w50" name="web_keyword" value="{$info['web_keyword']}" />
            <div class="tips"></div>
          </div>
        </div>
        <div class="form-group">
          <div class="label">
            <label>{:L("wangzhanmiaoshu")}：</label>
          </div>
          <div class="field">
            <textarea class="input w50" name="web_description">{$info['web_description']}</textarea>
            <div class="tips"></div>
          </div>
        </div>
        <div class="form-group">
          <div class="label">
            <label>{:L("gongzhonghaoewm")}：</label>
          </div>
          <div class="field">
            <input type="file" class="button bg-blue" name="wxperm" value="+ {:L('liulanshangchuan')}" onchange="preview(this,'preview1')" style="float: left;">
            <div id="preview1" name="img" style="float: left;width: 10%;box-sizing: border-box;" class="input" >
              <empty name="info['wxperm']">
                <img src="__PUBLIC__/images/zanwu.jpg" width="100%" />
                <else />
                <img src="__ROOT__/{$info['wxperm']}" width="100%" />
              </empty>
            </div>
            <div class="tipss">{:L("tuijianchicun")}：100*100</div>
          </div>
        </div>
        <div class="form-group">
          <div class="label">
            <label>{:L("shoujiduanewm")}：</label>
          </div>
          <div class="field">
            <input type="file" class="button bg-blue" name="weperm" value="+ {:L('liulanshangchuan')}" onchange="preview(this,'preview2')" style="float: left;">
            <div id="preview2" name="img" style="float: left;width: 10%;box-sizing: border-box;" class="input" >
              <empty name="info['weperm']">
                <img src="__PUBLIC__/images/zanwu.jpg" width="100%" />
                <else />
                <img src="__ROOT__/{$info['weperm']}" width="100%" />
              </empty>
            </div>
            <div class="tipss">{:L("tuijianchicun")}：100*100</div>
          </div>
        </div>
        <style>
          #mylink input{ float: none; display: inline; }
        </style>
        <div id="mylink">
          <if condition="$mylink">
            {$mylink}
            <else/>
            <div class="form-group">
              <div class="label"><label>{:L("youqinglianjie")}：</label></div>
              <div class="field">
                <input type="text" class="input" style="width:200px;" name="linkt[]" placeholder="{:L('biaoti')}"/>　
                <input type="text" class="input" style="width:300px;" name="linkl[]" placeholder="{:L('dizhi')}"/>　
                <a href="javascript:void(0)" class="mya1 button bg-main">{:L('tianjia')}</a>　
              </div>
            </div>
          </if>
        </div>
        <div class="form-group">
          <div class="label">
            <label>{:L("beianxinxi")}：</label>
          </div>
          <div class="field">
            <textarea class="input" name="web_record" style="width:600px;">{$info['web_record']}</textarea>
            <div class="tips"></div>
          </div>
        </div>
        <div class="form-group">
          <div class="label">
            <label>{:L("dibuxinxi")}：</label>
          </div>
          <div class="field">
            <textarea class="input" name="web_bottom" style="width:600px;">{$info['web_bottom']}</textarea>
            <div class="tips"></div>
          </div>
        </div>
        <div class="form-group">
          <div class="label">
            <label></label>
          </div>
          <div class="field">
            <button class="button bg-main icon-check-square-o" type="submit"> {:L("tijiao")}</button>
          </div>
        </div>
      </form>
    </div>
  </div>
  <script type="text/javascript">
    $(document).ready(function(){
      $(".mya1").click(function(){
        var html = '<div class="form-group"> ';
        html += '<div class="label"><label></label></div>';
        html += '<div class="field"> ';
        html += '<input type="text" class="input" style="width:200px;" name="linkt[]" placeholder="{:L("biaoti")}" />　';
        html += '<input type="text" class="input" style="width:300px;" name="linkl[]" placeholder="{:L("dizhi")}" />　';
        html += '<a href="javascript:void(0)" class="mya1 button bg-red" onclick="itemdel(this)">{:L("shanchu")}</a>';
        html += '</div></div>';
        $("#mylink").append(html);
      });
    });
    function preview(file,tempid){
      var prevDiv = document.getElementById(tempid);
      if (file.files && file.files[0]){
        var reader = new FileReader();
        reader.onload = function(evt){
          prevDiv.innerHTML = '<img src="' + evt.target.result + '" width="100%" />';
        }
        reader.readAsDataURL(file.files[0]);
      }
      else{
        prevDiv.innerHTML = '<div class="img" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src=\'' + file.value + '\'"></div>';
      }
    }
    function itemdel(t){
      $(t).parents('.form-group').remove();
    }
  </script>
</body>

</html>